
#pragma once


namespace __OCF_PROXY__ 
{


using namespace __OCF_BASE__;

#define MAX_INPUT	(4096)


#define __SYNC_CALL_7C82602D_4E46_47a6_BFDD_AD8D42FA3FCD__

template <class NC>
class CFrontToMiddle
{
	typedef TYPE_LIST05(USHORT,char,char*,int,int*) _OCF_PROXYSTUB_TYPELIST_T;
	enum __ENUM_PROXYSTUB_FUNCTION_TYPE__
	{
		__ENUM_FUNCTION_TYPE_fnRequestToMiddleWithAsync__ = 1,
		__ENUM_FUNCTION_TYPE_fnRequestToMiddleWithSync__ = 2,
		__ENUM_FUNCTION_TYPE_fnRequestToMiddleWithAsyncEcho__ = 3,
		__ENUM_FUNCTION_TYPE_fnRequestToMiddleWithSyncEcho__ = 4,

	};
	typedef NC _N_CLI_T;
public:
	CFrontToMiddle(_N_CLI_T* pcNc)
		:m_pcNc(pcNc)
	{
		m_ulLenSndBuff = 0;
		m_pSndBuff = NULL;
#ifdef __SYNC_CALL_7C82602D_4E46_47a6_BFDD_AD8D42FA3FCD__
		m_ulLenRcvBuff = 0;
		m_pRcvBuff = NULL;
#endif
	}
	virtual ~CFrontToMiddle()
	{
	}
	CFrontToMiddle& operator =(const CFrontToMiddle& cFrom)
	{
		m_pcNc = cFrom.m_pcNc;
		m_ulLenSndBuff = cFrom.m_ulLenSndBuff;
		m_pSndBuff = cFrom.m_pSndBuff;
#ifdef __SYNC_CALL_7C82602D_4E46_47a6_BFDD_AD8D42FA3FCD__
		m_ulLenRcvBuff = cFrom.m_ulLenRcvBuff;
		m_pRcvBuff = cFrom.m_pRcvBuff;
#endif

		return *this;
	}
	long fnRequestToMiddleWithAsync(const int nAuthKey)
	{
		COut<_OCF_PROXYSTUB_TYPELIST_T> cTmpOut_F74FAFA4_1595_44e4_A14C_6181269690D4_(m_ulLenSndBuff, m_pSndBuff);

		if (FALSE == cTmpOut_F74FAFA4_1595_44e4_A14C_6181269690D4_.Push(static_cast<USHORT>(1)).Push(nAuthKey).IsValid()) return -1;

		return m_pcNc->Send(cTmpOut_F74FAFA4_1595_44e4_A14C_6181269690D4_.GetDataLength(), cTmpOut_F74FAFA4_1595_44e4_A14C_6181269690D4_.GetStartDataPtr());
	}
	long fnRequestToMiddleWithSync(const int nAuthKey)
	{
		COut<_OCF_PROXYSTUB_TYPELIST_T> cTmpOut_F74FAFA4_1595_44e4_A14C_6181269690D4_(m_ulLenSndBuff, m_pSndBuff);

		if (FALSE == cTmpOut_F74FAFA4_1595_44e4_A14C_6181269690D4_.Push(static_cast<USHORT>(2)).Push(nAuthKey).IsValid()) return -1;

		return m_pcNc->SendAndRecv(cTmpOut_F74FAFA4_1595_44e4_A14C_6181269690D4_.GetDataLength(), cTmpOut_F74FAFA4_1595_44e4_A14C_6181269690D4_.GetStartDataPtr(), m_ulLenRcvBuff, m_pRcvBuff);
	}
	long fnRequestToMiddleWithSync_Return(int & nLenReturn,char * & pszReturn)
	{
		CIn<_OCF_PROXYSTUB_TYPELIST_T> cTmpIn_F74FAFA4_1595_44e4_A14C_6181269690D4_(m_ulLenRcvBuff, m_pRcvBuff);

		USHORT uiTmpOut_F74FAFA4_1595_44e4_A14C_6181269690D4_;
		if (FALSE == cTmpIn_F74FAFA4_1595_44e4_A14C_6181269690D4_.Pop(uiTmpOut_F74FAFA4_1595_44e4_A14C_6181269690D4_).Pop(nLenReturn,(const char ** )(&pszReturn)).IsValid()) return -1;
		return 0;
	}
	long fnRequestToMiddleWithAsyncEcho(const int nInLen,const char * pszInString)
	{
		COut<_OCF_PROXYSTUB_TYPELIST_T> cTmpOut_F74FAFA4_1595_44e4_A14C_6181269690D4_(m_ulLenSndBuff, m_pSndBuff);

		if (FALSE == cTmpOut_F74FAFA4_1595_44e4_A14C_6181269690D4_.Push(static_cast<USHORT>(3)).Push(nInLen,pszInString).IsValid()) return -1;

		return m_pcNc->Send(cTmpOut_F74FAFA4_1595_44e4_A14C_6181269690D4_.GetDataLength(), cTmpOut_F74FAFA4_1595_44e4_A14C_6181269690D4_.GetStartDataPtr());
	}
	long fnRequestToMiddleWithSyncEcho(const int nInLen,const char * pszInString)
	{
		COut<_OCF_PROXYSTUB_TYPELIST_T> cTmpOut_F74FAFA4_1595_44e4_A14C_6181269690D4_(m_ulLenSndBuff, m_pSndBuff);

		if (FALSE == cTmpOut_F74FAFA4_1595_44e4_A14C_6181269690D4_.Push(static_cast<USHORT>(4)).Push(nInLen,pszInString).IsValid()) return -1;

		return m_pcNc->SendAndRecv(cTmpOut_F74FAFA4_1595_44e4_A14C_6181269690D4_.GetDataLength(), cTmpOut_F74FAFA4_1595_44e4_A14C_6181269690D4_.GetStartDataPtr(), m_ulLenRcvBuff, m_pRcvBuff);
	}
	long fnRequestToMiddleWithSyncEcho_Return(int & nOutLen,char * & pszOutString)
	{
		CIn<_OCF_PROXYSTUB_TYPELIST_T> cTmpIn_F74FAFA4_1595_44e4_A14C_6181269690D4_(m_ulLenRcvBuff, m_pRcvBuff);

		USHORT uiTmpOut_F74FAFA4_1595_44e4_A14C_6181269690D4_;
		if (FALSE == cTmpIn_F74FAFA4_1595_44e4_A14C_6181269690D4_.Pop(uiTmpOut_F74FAFA4_1595_44e4_A14C_6181269690D4_).Pop(nOutLen,(const char ** )(&pszOutString)).IsValid()) return -1;
		return 0;
	}
public:
#ifdef __SYNC_CALL_7C82602D_4E46_47a6_BFDD_AD8D42FA3FCD__
	inline void SetProxyInfo(ULONG ulLenSndBuff, void* pSndBuff, ULONG ulLenRcvBuff = 0, void* pRcvBuff = NULL) { m_ulLenSndBuff = ulLenSndBuff; m_pSndBuff = pSndBuff; m_ulLenRcvBuff = ulLenRcvBuff; m_pRcvBuff = pRcvBuff; }
	inline void SetProxyInfo_Return(ULONG ulLenRcvBuff, void* pRcvBuff) { m_ulLenRcvBuff = ulLenRcvBuff; m_pRcvBuff = pRcvBuff; }
	inline ULONG GetLengthSndBuff() { return m_ulLenSndBuff; }
	inline ULONG GetLengthRcvBuff() { return m_ulLenRcvBuff; }
	inline void* GetSndBuff() { return m_pSndBuff; }
	inline void* GetRcvBuff() { return m_pRcvBuff; }
#else
	inline void SetProxyInfo(ULONG ulLenSndBuff, void* pSndBuff) { m_ulLenSndBuff = ulLenSndBuff; m_pSndBuff = pSndBuff; }
	inline ULONG GetLengthSndBuff() { return m_ulLenSndBuff; }
	inline void* GetSndBuff() { return m_pSndBuff; }
#endif

private:
	ULONG m_ulLenSndBuff;
	void* m_pSndBuff;
#ifdef __SYNC_CALL_7C82602D_4E46_47a6_BFDD_AD8D42FA3FCD__
	ULONG m_ulLenRcvBuff;
	void* m_pRcvBuff;
#endif
	_N_CLI_T* m_pcNc;
};


#undef __SYNC_CALL_7C82602D_4E46_47a6_BFDD_AD8D42FA3FCD__


template <class NC>
class CMiddleToFront
{
	typedef TYPE_LIST05(USHORT,char,char*,int,int*) _OCF_PROXYSTUB_TYPELIST_T;
	enum __ENUM_PROXYSTUB_FUNCTION_TYPE__
	{
		__ENUM_FUNCTION_TYPE_fnReturnWithAsync__ = 101,
		__ENUM_FUNCTION_TYPE_fnReturnWithAsyncEcho__ = 102,

	};
	typedef NC _N_CLI_T;
public:
	CMiddleToFront(_N_CLI_T* pcNc)
		:m_pcNc(pcNc)
	{
		m_ulLenSndBuff = 0;
		m_pSndBuff = NULL;
#ifdef __SYNC_CALL_7C82602D_4E46_47a6_BFDD_AD8D42FA3FCD__
		m_ulLenRcvBuff = 0;
		m_pRcvBuff = NULL;
#endif
	}
	virtual ~CMiddleToFront()
	{
	}
	CMiddleToFront& operator =(const CMiddleToFront& cFrom)
	{
		m_pcNc = cFrom.m_pcNc;
		m_ulLenSndBuff = cFrom.m_ulLenSndBuff;
		m_pSndBuff = cFrom.m_pSndBuff;
#ifdef __SYNC_CALL_7C82602D_4E46_47a6_BFDD_AD8D42FA3FCD__
		m_ulLenRcvBuff = cFrom.m_ulLenRcvBuff;
		m_pRcvBuff = cFrom.m_pRcvBuff;
#endif

		return *this;
	}
	long fnReturnWithAsync(const int nLenReturn,const char * pszReturn)
	{
		COut<_OCF_PROXYSTUB_TYPELIST_T> cTmpOut_F74FAFA4_1595_44e4_A14C_6181269690D4_(m_ulLenSndBuff, m_pSndBuff);

		if (FALSE == cTmpOut_F74FAFA4_1595_44e4_A14C_6181269690D4_.Push(static_cast<USHORT>(101)).Push(nLenReturn,pszReturn).IsValid()) return -1;

		return m_pcNc->Send(cTmpOut_F74FAFA4_1595_44e4_A14C_6181269690D4_.GetDataLength(), cTmpOut_F74FAFA4_1595_44e4_A14C_6181269690D4_.GetStartDataPtr());
	}
	long fnReturnWithAsyncEcho(const int nOutLen,const char * pszOutString)
	{
		COut<_OCF_PROXYSTUB_TYPELIST_T> cTmpOut_F74FAFA4_1595_44e4_A14C_6181269690D4_(m_ulLenSndBuff, m_pSndBuff);

		if (FALSE == cTmpOut_F74FAFA4_1595_44e4_A14C_6181269690D4_.Push(static_cast<USHORT>(102)).Push(nOutLen,pszOutString).IsValid()) return -1;

		return m_pcNc->Send(cTmpOut_F74FAFA4_1595_44e4_A14C_6181269690D4_.GetDataLength(), cTmpOut_F74FAFA4_1595_44e4_A14C_6181269690D4_.GetStartDataPtr());
	}
public:
#ifdef __SYNC_CALL_7C82602D_4E46_47a6_BFDD_AD8D42FA3FCD__
	inline void SetProxyInfo(ULONG ulLenSndBuff, void* pSndBuff, ULONG ulLenRcvBuff = 0, void* pRcvBuff = NULL) { m_ulLenSndBuff = ulLenSndBuff; m_pSndBuff = pSndBuff; m_ulLenRcvBuff = ulLenRcvBuff; m_pRcvBuff = pRcvBuff; }
	inline void SetProxyInfo_Return(ULONG ulLenRcvBuff, void* pRcvBuff) { m_ulLenRcvBuff = ulLenRcvBuff; m_pRcvBuff = pRcvBuff; }
	inline ULONG GetLengthSndBuff() { return m_ulLenSndBuff; }
	inline ULONG GetLengthRcvBuff() { return m_ulLenRcvBuff; }
	inline void* GetSndBuff() { return m_pSndBuff; }
	inline void* GetRcvBuff() { return m_pRcvBuff; }
#else
	inline void SetProxyInfo(ULONG ulLenSndBuff, void* pSndBuff) { m_ulLenSndBuff = ulLenSndBuff; m_pSndBuff = pSndBuff; }
	inline ULONG GetLengthSndBuff() { return m_ulLenSndBuff; }
	inline void* GetSndBuff() { return m_pSndBuff; }
#endif

private:
	ULONG m_ulLenSndBuff;
	void* m_pSndBuff;
#ifdef __SYNC_CALL_7C82602D_4E46_47a6_BFDD_AD8D42FA3FCD__
	ULONG m_ulLenRcvBuff;
	void* m_pRcvBuff;
#endif
	_N_CLI_T* m_pcNc;
};


#undef __SYNC_CALL_7C82602D_4E46_47a6_BFDD_AD8D42FA3FCD__
}
